//
//  ZZCURLSchemeParser.swift
//  ewgShop
//
//  Created by zzc on 2019/8/5.
//  Copyright © 2019 zzc. All rights reserved.
//

import UIKit

class ZZCURLSchemeParser: NSObject {
    
    var whiteList = NSMutableArray.init()
    var balckList = NSMutableArray.init()
    
    /*
     ** 是否在白名单
     */
    func whiteListHasScheme(scheme : String) -> Bool {
        if self.whiteList.contains(scheme) {
            return true
        }else{
            return false
        }
    }
    
    /// 是否在黑名单
    ///
    /// - Parameter scheme: 请求url scheme
    /// - Returns: bool
    func blackListHasScheme(scheme:String) -> Bool {
        if self.balckList.contains(scheme) {
            return true
        }else{
            return false
        }
    }
    
    /// 注册白名单 scheme
    ///
    /// - Parameter scheme: 请求url scheme
    func registerToWhiteListWithScheme(scheme:String) {
        if self.whiteListHasScheme(scheme: scheme) {
            return;
        }
        self.whiteList.add(scheme)
    }
    
    /// 注册黑名单
    ///
    /// - Parameter scheme: 请求url scheme
    func registerToBlackListWithScheme(scheme:String){
        if self.blackListHasScheme(scheme: scheme) {
            return;
        }
        self.balckList.add(scheme)
    }
    

}
